<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
<script type="text/javascript" src="${staticServer}/common/uploadify/jquery.uploadify.js"></script>
<script type="text/javascript" src="${staticServer}/js/web/uploadImg.js?1.5"></script>
	
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

$(function(){
	$("#center_id").val("<#if pos??>${pos.center_id}</#if>");
	$("#state").val("<#if pos??>${pos.state}</#if>");
	$("#username").val("<#if pos??>${pos.username}</#if>");
	
});

var addPos = function(){
	var id = $("#id").val();
	var center_id = $("#center_id").val();
	var sh_id = $("#sh_id").val();
	var xyk_fl = $("#xyk_fl").val();
	var jjk_fl = $("#jjk_fl").val();
	var pos_sj = $("#pos_sj").val();
	var bank_id = $("#bank_id").val();
	
	var yyzz = $("#yyzz").val();
	var id_card = $("#id_card").val();
	var images = $("#all_words").val();
	var username = $("#username").val();
	var phone = $("#phone").val();
	var xiane = $("#xiane").val();
	var msg = $("#msg").val();
	var banli_date = $("#banli_date").val();
	var state = $("#state").val();
	
	if(center_id==""){
		infopad.err("请选择中心!");
		return;
	}
	if(username==""){
		infopad.err("请选择联系人!");
		return;
	}
	if(state==""){
		infopad.err("请选择使用状态!");
		return;
	}
	
	$.post("${contextPath}/index/add_pos_go.json", {
			"id":id,
			"center_id":center_id,
			"sh_id":sh_id,
			"xyk_fl":xyk_fl,
			"jjk_fl":jjk_fl,
			"pos_sj":pos_sj,
			"bank_id":bank_id,
			"yyzz":yyzz,
			"id_card":id_card,
			"images":images,
			"username":username,
			"phone":phone,
			"xiane":xiane,
			"msg":msg,
			"state":state,
			"banli_date":banli_date
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("操作成功！");
				window.location.href="${contextPath}/index/posList.htm";
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

</script>
</head>
<input type="hidden" id="id" value="<#if pos??>${pos.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>组织架构</li>
			<li>&gt;</li>
			<li class="current">title</li>
		</ul>
	</div>

	<div id="container">
		<div id="title">添加Pos机</div>
		<table id="infotable">
			<tr>
				<th>办公地址:</th>
				<td>
				<select id="center_id">
					<option value="">请选择中心</option>
					<#if offList??>
						<#list offList as list>
							<option value="${list.id}">${list.name}</option>
						</#list>
					</#if>
				</select>
				</td>
			</tr>
			
			<tr>
				<th>商户号/终端号:</th>
				<td><input id="sh_id" type="text" value="<#if pos??>${pos.sh_id}</#if>" size="50" maxlength="30" /></td>
			</tr>
			
			<tr>
				<th>信用卡费率:</th>
				<td><input id="xyk_fl" type="text" value="<#if pos??>${pos.xyk_fl}</#if>" size="50" maxlength="30" /></td>
			</tr>
			
			<tr>
				<th>借记卡费率:</th>
				<td><input id="jjk_fl" type="text" value="<#if pos??>${pos.jjk_fl}</#if>" size="50" maxlength="30" /></td>
			</tr>
			
			<tr>
				<th>刷卡限额:</th>
				<td><input id="xiane" type="text" value="<#if pos??>${pos.xiane}</#if>" size="50" maxlength="30" /></td>
			</tr>
			
			<tr>
				<th>pos机商家:</th>
				<td><input id="pos_sj" type="text" value="<#if pos??>${pos.pos_sj}</#if>" size="50" maxlength="30" /></td>
			</tr>
			<tr>
				<th>绑定的银行卡（或者公用账户）:</th>
				<td><input id="bank_id" type="text" value="<#if pos??>${pos.bank_id}</#if>" size="50" maxlength="30" /></td>
			</tr>
			<tr>
				<th>绑定的营业执照:</th>
				<td><input id="yyzz" type="text" value="<#if pos??>${pos.yyzz}</#if>" size="50" maxlength="30" /></td>
			</tr>
			<tr>
				<th>绑定的身份证:</th>
				<td><input id="id_card" type="text" value="<#if pos??>${pos.id_card}</#if>" size="50" maxlength="30" /></td>
			</tr>
			<tr>
				<th>照片:</th>
				<td>
					<ul class="imglist">
					<div id="images" style="float: left;">
						<#if pos?? && pos.images?? && pos.images!="">
							<#list pos.images?split(",") as imgurl>
								<#if imgurl_index !=0>
								<li style="float:left;list-style-type: none;line-height:180px;*font-size:157px;"><img rel="800:485" width="180" height="109.125" src="http://www.yueqiao.org${imgurl}"></li>
								</#if>
							</#list>
						</#if>
					</div>
						
					<a class="file_box" style="list-style-type: none;float: left;display: block; width:180px; height:180px; overflow: hidden; border: 1px solid #EBEBEB; background: none repeat scroll 0 0 #F3F3F3; color: #999999; cursor: pointer; text-align: center; margin-left:10px; ">
                    <em style="background:url(${staticServer}/img/add_newpic.png) 0 0; display: inline-block; width:180px; height:180px; overflow: hidden;line-height: 20em; vertical-align: middle;">
                    <input type="file" id="upload" style="display: block;width:180px; height:180px;opacity: 0; filter:alpha(opacity=0); "></em>
                    </a>
                    <label class="zt_widthlabel" style=" font-size:9px; float:left; visibility:hidden;">文件：</label>
                    <input type="text" id="all_words" style=" width:100px; height:10px; float:left;visibility:hidden;" class="input w180" value="">
					</ul>
				</td>
			</tr>
			
			<tr>
				<th>联系人:</th>
				<td>
					<select id="username">
					<#if uList??>
						<option value="">请选择联系人</option>
						<#list uList as list>
							<option value="${list.username}">${list.nickname}</option>
						</#list>
					</#if>
					</select>
				</td>
			</tr>
			<tr>
				<th>联系方式:</th>
				<td><input id="phone" type="text" value="<#if pos??>${pos.phone}</#if>" size="50" maxlength="30" /></td>
			</tr>
			
			<tr>
				<th>办理日期:</th>
				<td style="height:20px;">
					<input type="text" id="banli_date" value="<#if pos??>${pos.banli_date}</#if>" rel="DATE::Y-m-d" value="" size="15" maxlength="15" readonly="readonly" class="DatePicker_Icon">
				</td>
			</tr>
			
			<tr>
				<th>需处理情况:</th>
				<td><input id="msg" type="text" value="<#if pos??>${pos.msg}</#if>" size="50" maxlength="30" /></td>
			</tr>
			
			<tr>
				<th>状态:</th>
				<td>
					<select id="state">
						<option value="">请选择</option>
						<option value="0">在用</option>
						<option value="1">备用</option>
						<option value="2">废弃</option>
					</select>
				</td>
			</tr>
			
		</table>
		<div id="controlbar">
			<input type="button" class="submit" onclick="addPos()" value="  保  存  " />
		</div>
	</div>
	
</body>
</html>